Skip to main content

GetRange

Returns a Range object that represents the part of the document contained in the specified run.

Syntax

expression.GetRange(Start, End);

expression - A variable that represents a ApiRun class.

Parameters

NameRequired/OptionalData typeDefaultDescription
StartRequiredNumberStart position index in the current element.
EndRequiredNumberEnd position index in the current element.

Returns

ApiRange

Example

This example shows how to get a Range object that represents the part of the document contained in the specified run.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let run = Api.CreateRun();
run.AddText("This is just a sample text.");
paragraph.AddElement(run);
let range = run.GetRange(0, 3);
range.SetBold(true);